import { createSSRApp } from 'vue';
import uviewPlus from 'uview-plus';
import * as Pinia from 'pinia';
import { createUnistorage } from 'pinia-plugin-unistorage';
import CustomLoadingPage from './components/common/CustomLoadingPage/CustomLoadingPage.vue';
import CustomToast from './components/common/CustomToast/CustomToast.vue';
import './assets/scss/variable.scss';

import App from './App.vue';

export function createApp() {
  const pinia = Pinia.createPinia();
  const app = createSSRApp(App);

  pinia.use(createUnistorage());
  app.use(uviewPlus);
  app.use(pinia);

  app.component('CustomLoadingPage', CustomLoadingPage);
  app.component('CustomToast', CustomToast);

  return {
    app,
    Pinia,
  };
}
